<template>
  <div>
    
     <!-- <el-select v-model="selectedNode" placeholder="请选择" style="width:400px;">
      <el-option style="height: auto;">
       <el-tree  
        :data="treeData"
        :props="defaultProps"
        node-key="deptId"
        highlight-current
        @node-click="handleNodeClick"
        ref="treeRef"
        class="custom-tree">

         <template #default="{ node, data }">
            <span class="custom-tree-node">
              <span>{{ data.deptName }}</span>
            </span>
       </template>
       </el-tree>
       </el-option>
     </el-select> -->

     <!--  -->
      <el-tree-select
        v-model="sel"
        :data="treeData"
        check-strictly
        :props="defaultProps"
         node-key="deptId"
        :render-after-expand="false"
        style="width: 240px"
      />
  </div>
</template>
<script lang="ts" setup>
   import { defineProps,ref,defineEmits,defineModel,watch} from 'vue'
  //  定义一个 父传子的数据
 let {treeData}= defineProps<{
    treeData:any[]
   }>()



  const defaultProps = {
    children: 'children',
    label: 'deptName',
    value: 'deptId'
  }
 
  let sel=defineModel()




    // console.log(treeData,"----父传子的数据--------")
    //  let emits=defineEmits(["sendParentId"])
  // let handleNodeClick=(node:any)=>{
  //     console.log(node,"-------点击后的值-------")
  //     emits("sendParentId",selectedNode.value) //传送当前行id
  // }
  // let selectedNode=ref('')

</script>